package com.laolang.gongda.bookshop.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 首页处理器，在访问首页时，做初始化工作，如初始化显示的类别
 * 
 * @author 小代码
 * @version 1.0
 *
 */
@Controller
public class IndexController {
	
	Logger log = LoggerFactory.getLogger("infoLog");

	@RequestMapping(value = { "/" }, method = RequestMethod.HEAD, produces = "text/html")
	public String head() {
		return "index";
	}

	/**
	 * 
	 * @param model
	 * @return
	 */
	@RequestMapping(value = { "/", "index" }, method = RequestMethod.GET, produces = "text/html")
	public String index(Model model) {
		model.addAttribute("msg", "Hello 小代码");
		log.info("打开首页");
		return "index";
	}

}